package com.ygj.employeeReport.service.phenomenon.impl;

import java.util.List;

import javax.annotation.Resource;

import com.base.common.persistent.dao.MaintenanceClassMapper;
import org.springframework.stereotype.Service;

import com.base.common.ConfigConstants;
import com.base.common.enums.TicketCategories;
import com.base.common.persistent.dao.TicketMapper;
import com.base.common.persistent.model.Ticket;
import com.ygj.employeeReport.service.base.impl.TicketBaseServiceImpl;
import com.ygj.employeeReport.service.phenomenon.PhenomenonService;
import com.ygj.ticketManage.service.TicketManageService;

@Service("phenomenonService")
public class PhenomenonServiceImpl extends TicketBaseServiceImpl implements
		PhenomenonService {

	@Resource
	private TicketMapper ticketMapper;

	@Resource
	private TicketManageService ticketManageService;

	@Resource
	private MaintenanceClassMapper maintenanceClassMapper;

	@Override
	public List<Ticket> getPhenomenonByEmployeeId(int employeeId, int page) {
		return ticketMapper.queryTicketsByCategoriesAndEmployeeId(
				getStartNum(page), Integer.parseInt(ConfigConstants.INFOS_LIST_NUM),
				TicketCategories.PHENOMENON.getValue(), employeeId);
	}

	@Override
	public int distributeTickets(String code, List<String> distributeInfoList) {
		String[] ticketIdArr = new String[] { ticketMapper.queryTicketByCode(
				code.trim()).getId()
				+ "" };
		return ticketManageService.distributeTickets(ticketIdArr,
				distributeInfoList);
	}

	@Override
	public Object getMaintenanceClass() {
		return maintenanceClassMapper.selectAll();
	}

	/*
	 * public static void main(String[] args) { Date date = new Date(1421830018
	 * / 1000 /60); System.out.println(date); }
	 */

}
